//package com.xiguaji.tiktok.task.ranking.repository.impl;
//
//import com.xiguaji.boot.toolkit.DateTimeUtils;
//import com.xiguaji.tiktok.task.ranking.model.Ranking;
//import com.xiguaji.tiktok.task.ranking.repository.RankingExtRepository;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.jdbc.core.BatchPreparedStatementSetter;
//import org.springframework.jdbc.core.JdbcTemplate;
//
//import java.sql.PreparedStatement;
//import java.sql.SQLException;
//import java.util.List;
//
//public class RankingExtRepositoryImpl implements RankingExtRepository {
//
//    @Autowired
//    JdbcTemplate jdbcTemplate;
//
//    @Override
//    public void bathSave(List<Ranking> rankings) {
//        long seconds = DateTimeUtils.currentTimeSecond();
//
//        jdbcTemplate.batchUpdate("INSERT INTO " +
//                "`tiktok`.`ranking`" +
//                "(`blogger_type`, `ranking`, `ranking_type`, `blogger_id`, `uid`," +
//                " `nickname`, `unique_id`, `avatar`, `state`, `position`, " +
//                "`follower`,`score`, `likes_growth`,`review_growth`,`share_growth`, `belong`, " +
//                "`create_time`, `create_by`, `update_time`, `update_by`) " +
//                "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?)", new BatchPreparedStatementSetter() {
//            @Override
//            public void setValues(PreparedStatement preparedStatement, int i) throws SQLException {
//                Ranking ranking = rankings.get(i);
//                preparedStatement.setLong(1,ranking.getBloggerType());
//                preparedStatement.setInt(2,ranking.getRanking());
//                preparedStatement.setInt(3,ranking.getRankingType());
//                preparedStatement.setLong(4,ranking.getBloggerId());
//                preparedStatement.setLong(5,ranking.getUid());
//                preparedStatement.setString(6,ranking.getNickname());
//                preparedStatement.setString(7,ranking.getUniqueId());
//                preparedStatement.setString(8,ranking.getAvatar());
//                preparedStatement.setString(9,ranking.getState());
//                preparedStatement.setInt(10,ranking.getPosition());
//                preparedStatement.setInt(11,ranking.getFollower());
//                preparedStatement.setDouble(12,ranking.getScore());
//                preparedStatement.setLong(13,ranking.getLikesGrowth());
//                preparedStatement.setLong(14,ranking.getReviewGrowth());
//                preparedStatement.setLong(15,ranking.getShareGrowth());
//                preparedStatement.setLong(16,ranking.getBelong());
//                preparedStatement.setLong(17,seconds);
//                preparedStatement.setString(18,ranking.getCreateBy());
//                preparedStatement.setLong(19,seconds);
//                preparedStatement.setString(20,ranking.getUpdateBy());
//            }
//
//            @Override
//            public int getBatchSize() {
//                return rankings.size();
//            }
//        });
//    }
//}
